﻿Public Class SettingsForm

    Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
        My.Settings.Save()
        Me.Close()
    End Sub

    Private Sub SettingsForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.cbSyncEvery.Enabled = My.Settings.CanAutoSync
        Try
            Me.lblVersion.Text = My.Application.Deployment.CurrentVersion.ToString(4)
        Catch ex As Exception

        End Try
    End Sub

    Private Sub btnInitialSync_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInitialSync.Click
        Dim frm As New InitialSyncForm
        frm.ShowDialog()
    End Sub

    Private Sub btnOpenLogFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenLogFile.Click
        Try
            Process.Start(IO.Path.GetDirectoryName(My.Application.Log.DefaultFileLogWriter.FullLogFileName))
        Catch ex As Exception
            MessageBox.Show("Error openning the log file")
        End Try
    End Sub

    Private Sub btnCurrentFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCurrentFolder.Click
        Process.Start(My.Computer.FileSystem.CurrentDirectory)
    End Sub

    Private Sub chkCanAutoSync_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkCanAutoSync.CheckedChanged
        If chkCanAutoSync.Checked Then
            Me.cbSyncEvery.Enabled = True
        Else
            Me.cbSyncEvery.Enabled = chkCanAutoSync.Checked
        End If
    End Sub
End Class